﻿/*CREATE VIEW dbo.INVOICE_OUT_VIEW
AS
SELECT     dbo.INVOICE_OUT.ID, dbo.INVOICE_OUT.NUMBER, dbo.INVOICE_OUT.DATE, dbo.INVOICE_OUT.SUM, dbo.INVOICE_OUT.ADVANCE_PERCENT, 
                      dbo.INVOICE_OUT.STATE, dbo.INVOICE_OUT.DESCRIPTION, dbo.INVOICE_OUT.LAST_UPDATE, dbo.INVOICE_OUT.LAST_UPDATE_USER, 
                      dbo.NSI_CURRENCY.SHORT_NAME AS CURRENCY_NAME, dbo.CONTRACT.NUMBER AS CONTRACT_NUMBER, 
                      dbo.NSI_ORGANIZATION.SHORT_NAME AS ORG_NAME
FROM         dbo.CONTRACT LEFT OUTER JOIN
                      dbo.NSI_ORGANIZATION ON dbo.CONTRACT.NSI_ORGANIZATION_ID = dbo.NSI_ORGANIZATION.ID RIGHT OUTER JOIN
                      dbo.CALENDAR_PLAN ON dbo.CONTRACT.ID = dbo.CALENDAR_PLAN.CONTRACT_ID RIGHT OUTER JOIN
                      dbo.CP_STAGE ON dbo.CALENDAR_PLAN.ID = dbo.CP_STAGE.CALENDAR_PLAN_ID RIGHT OUTER JOIN
                      dbo.PRODUCT_UNIT ON dbo.CP_STAGE.ID = dbo.PRODUCT_UNIT.CP_STAGE_ID LEFT OUTER JOIN
                      dbo.NSI_PRODUCT ON dbo.PRODUCT_UNIT.NSI_PRODUCT_ID = dbo.NSI_PRODUCT.ID LEFT OUTER JOIN
                      dbo.COST_PROTOCOL LEFT OUTER JOIN
                      dbo.NSI_CURRENCY ON dbo.COST_PROTOCOL.NSI_CURRENCY_ID = dbo.NSI_CURRENCY.ID RIGHT OUTER JOIN
                      dbo.PRODUCT_COST ON dbo.COST_PROTOCOL.ID = dbo.PRODUCT_COST.COST_PROTOCOL_ID ON 
                      dbo.PRODUCT_UNIT.ID = dbo.PRODUCT_COST.PRODUCT_UNIT_ID RIGHT OUTER JOIN
                      dbo.INVOICE_OUT_ITEM ON dbo.PRODUCT_UNIT.ID = dbo.INVOICE_OUT_ITEM.PRODUCT_UNIT_ID RIGHT OUTER JOIN
                      dbo.INVOICE_OUT ON dbo.INVOICE_OUT_ITEM.INVOICE_OUT_ID = dbo.INVOICE_OUT.ID*/

GO
/*EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[53] 4[20] 2[8] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "COST_PROTOCOL"
            Begin Extent = 
               Top = 13
               Left = 673
               Bottom = 128
               Right = 855
            End
            DisplayFlags = 280
            TopColumn = 2
         End
         Begin Table = "INVOICE_OUT"
            Begin Extent = 
               Top = 0
               Left = 67
               Bottom = 115
               Right = 249
            End
            DisplayFlags = 280
            TopColumn = 5
         End
         Begin Table = "PRODUCT_COST"
            Begin Extent = 
               Top = 8
               Left = 550
               Bottom = 123
               Right = 736
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "PRODUCT_UNIT"
            Begin Extent = 
               Top = 7
               Left = 402
               Bottom = 122
               Right = 586
            End
            DisplayFlags = 280
            TopColumn = 1
         End
         Begin Table = "CALENDAR_PLAN"
            Begin Extent = 
               Top = 139
               Left = 419
               Bottom = 254
               Right = 601
            End
            DisplayFlags = 280
            TopColumn = 2
         End
         Begin Table = "CONTRACT"
            Begin Extent = 
               Top = 136
               Left = 647
               Bottom = 251
               Right = 864
            End
            DisplayFlags = 280
            TopColumn = 1
         End
         Begin Table = "CP_STAGE"
            Begin Extent = 
               Top = 145
               Left = 241
               Bottom = 260
               Right = 423
            End', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'INVOICE_OUT_VIEW';*/


GO
/*EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane2', @value = N'DisplayFlags = 280
            TopColumn = 2
         End
         Begin Table = "NSI_ORGANIZATION"
            Begin Extent = 
               Top = 147
               Left = 1064
               Bottom = 262
               Right = 1246
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "INVOICE_OUT_ITEM"
            Begin Extent = 
               Top = 7
               Left = 278
               Bottom = 122
               Right = 460
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "NSI_CURRENCY"
            Begin Extent = 
               Top = 16
               Left = 889
               Bottom = 131
               Right = 1071
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "NSI_PRODUCT"
            Begin Extent = 
               Top = 120
               Left = 38
               Bottom = 235
               Right = 220
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1635
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'INVOICE_OUT_VIEW';*/


GO
/*EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 2, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'INVOICE_OUT_VIEW';*/

